package org.l.qiao.el;

/**
 * Created by 严秋旺 on 2016/2/4.<br />
 * EL表达式操作不支持对象异常
 */
public class UnsupportObjectException extends RuntimeException {
    /**
     * 错误对象
     */
    private Object object;

    /**
     * 创建不支持对象异常
     */
    public UnsupportObjectException() {
    }

    /**
     * 创建不支持对象异常
     *
     * @param message 异常信息
     */
    public UnsupportObjectException(String message) {
        super(message);
    }

    /**
     * 创建不支持对象异常
     *
     * @param message 异常信息
     * @param object  异常对象
     */
    public UnsupportObjectException(String message, Object object) {
        super(message);
        this.object = object;
    }

    /**
     * 获取异常对象
     *
     * @return 异常对象
     */
    public Object getObject() {
        return object;
    }

    @Override
    public String toString() {
        Object object = getObject();
        return super.toString() + (object == null ? "" : ":" + object.toString());
    }
}
